package com.lw.service;

import com.lw.pojo.Bgm;
import com.lw.web.util.JsonUtils;
import com.lw.web.util.ZKCurator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class VideoServiceImpl {

    @Autowired
    private ZKCurator zkCurator;

    public void addBgm(Bgm bgm){
        //省略和数据库操作

//        Map<String, String> map = new HashMap<>();
//        map.put("operType","add");
//        map.put("path", bgm.getPath());
//
//        zkCurator.sendBgmOperator(bgm.getId(), JsonUtils.objectToJson(map));

        zkCurator.sendBgmOperator(bgm.getId(),"add");
    }

    public void deleteBgm(Bgm bgm){
//        Map<String, String> map = new HashMap<>();
//        map.put("operType", "delete");
//        map.put("path", bgm.getPath());
//
//        zkCurator.sendBgmOperator(bgm.getId(), JsonUtils.objectToJson(map));

        zkCurator.sendBgmOperator(bgm.getId(),"delete");
    }
}
